home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / H-I / HDA Tech Note #1.cpt / HDA Tech Note #1 / card_4780.txt < prev    next >
Text File  |  1989-02-26  |  2KB  |  56 lines

  1. -- card: 4780 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 2619
  5. -- name: CONDITIONAL EXECUTION
  6.  
  7.  
  8. -- part 1 (field)
  9. -- low flags: 01
  10. -- high flags: 0001
  11. -- rect: left=37 top=42 right=91 bottom=475
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 1
  15. -- font id: 3
  16. -- text size: 12
  17. -- style flags: 8448
  18. -- line height: 16
  19. -- part name: 
  20.  
  21.  
  22. -- part contents for card part 1
  23. ----- text -----
  24. General Design Principles
  25.  
  26. CONDITIONAL EXECUTION
  27.  
  28. -- part contents for background part 2
  29. ----- text -----
  30.  
  31. HyperDA does not support the if command structures.  But there may be some handlers you wish to execute only if the user is not using your stack under HyperDA.  To do this, simply create a handler that HyperDA will not recognize (any non-standard, user-defined handler) and put into that handler all of the operations you want performed when the user is running under HyperCard.
  32.  
  33. For example,  if you want to use a calculated navigational command if the user is in HyperCard but will use a straight-forward collection of go next commands if he‚Äôs browsing under HyperDA, simply write a handler like this one:
  34.  
  35. on mouseUp
  36.   doCalcMovement 4
  37.   exit mouseUp
  38.   go next
  39.   go next
  40.   go next
  41.   go next
  42. end mouseUp
  43.  
  44. Then program the doCalcMovement handler like this:
  45.  
  46. on doCalcMovement howMany
  47.   repeat howMany
  48.     go next
  49.   end repeat
  50. end doCalcMovement
  51.  
  52. When the user presses the mouse in the button involved in this process, HyperDA looks at the mouseUp handler.  It does not understand the first two lines, so it simply skips them.  Then it executes four go next statements.  But when the user presses the same button under HyperCard, the first two commands are acknowledged and executed, resulting in the repeat loop being executed and the mouseUp handler being exited.
  53.  
  54. This is a simple example designed to demonstrate the principle.  You will undoubtedly see many occasions in designing stacks for possible exploration under HyperDA when this approach will be useful.
  55.  
  56.